#include<iostream>
#include<vector>
using namespace std;

namespace i
{
	template<class T>
	class vector
	{
	public:
		typedef T* iterator;
		vector()
			:_start(nullptr)
			,_finsh(nullptr)
			,_end(nullptr)
		{

		}
		void reserve(size_t d1,T d2)
		{
			iterator cut;
			if (capacity() == size())
			{
				 cut = new T[4];
				_finsh += 4;
				_end += 4;
			}
			else
			{
				 cut = new T[d1];
				_finsh += d1;
				_end += d1;
			}

			//iterator tmp = _start;
			delete[] _start;
			_start = cut;
			*_end =  _start + d1;
			*_finsh = _start + size();

		}
		size_t capacity()
		{
			return _end - _start;
		}
		size_t size()
		{
			return _end - _finsh;
		}
		void push_pack(T d1)
		{
			if (_finsh == _end)
			{
				reserve(capacity() *2,d1);
			}
		}
		iterator begin()
		{
			return _start;
		}
		iterator end()
		{
			return _finsh;
		}
	private:
		iterator _start;
		iterator _finsh;
		iterator _end;
	};
}
int main()
{
	i::vector<int> it;
	it.push_pack(1);
	it.push_pack(1);
	it.push_pack(1);
	it.push_pack(1);

	for (auto e : it)
	{
		cout << e << " ";
	}
	return 0;
}